<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- 一男一女谈恋爱，现在能怀孕，就叫孩子他爹，如果怀不上，就叫老公，最后都会结婚 -->
  <script>
    const proGrent = false
    const promise = new Promise((resolve, reject) => {
      if (proGrent) {
        resolve('孩子他爹')
      } else {
        reject('老公')
      }
    })

    promise
      .then(result => {

        console.log(`男人成为了${result}`)
      })
      .catch(err => {
        console.log(`男人成为了${err}`)
      })
      .finally(() => {
        console.log('两个人最终结婚了')
      })

  </script>
</body>

</html>